#ifndef APPLYFRIENDPAGE_H
#define APPLYFRIENDPAGE_H

#include <QJsonArray>
#include <QVector>
#include <QWidget>
#include "userdata.h"
#include <memory>
#include <unordered_map>
class ApplyFriendItem;
namespace Ui {
class ApplyFriendPage;
}

class ApplyFriendPage : public QWidget
{
    Q_OBJECT

public:
    explicit ApplyFriendPage(QWidget *parent = nullptr);
    ~ApplyFriendPage();
    void addNewApply(std::shared_ptr<ApplyInfo> apply);
    bool hasUnAuthenFriend();

private:
    Ui::ApplyFriendPage *ui;
    std::unordered_map<int, ApplyFriendItem *> _unauthItemd;
    QVector<QString> heads;
    QVector<std::shared_ptr<AddFriendApply>> friendApplies;

private:
    void loadApplyList();
public slots:
    void slot_authRsp(std::shared_ptr<AuthRsp>);
signals:
    void sig_showSearch(bool);
    void sig_hasNewFriendApply(bool);
    // QWidget interface
protected:
    virtual void paintEvent(QPaintEvent *event) override;
};

#endif // APPLYFRIENDPAGE_H
